import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/emergency/emergency_response_card_entity.dart';

EmergencyResponseCardEntity $EmergencyResponseCardEntityFromJson(Map<String, dynamic> json) {
  final EmergencyResponseCardEntity emergencyResponseCardEntity = EmergencyResponseCardEntity();
  final String? applicableAccidentTypes = jsonConvert.convert<String>(json['applicableAccidentTypes']);
  if (applicableAccidentTypes != null) {
    emergencyResponseCardEntity.applicableAccidentTypes = applicableAccidentTypes;
  }
  final String? backView = jsonConvert.convert<String>(json['backView']);
  if (backView != null) {
    emergencyResponseCardEntity.backView = backView;
  }
  final String? cardholder = jsonConvert.convert<String>(json['cardholder']);
  if (cardholder != null) {
    emergencyResponseCardEntity.cardholder = cardholder;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    emergencyResponseCardEntity.companyCode = companyCode;
  }
  final String? createBy = jsonConvert.convert<String>(json['createBy']);
  if (createBy != null) {
    emergencyResponseCardEntity.createBy = createBy;
  }
  final String? createById = jsonConvert.convert<String>(json['createById']);
  if (createById != null) {
    emergencyResponseCardEntity.createById = createById;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    emergencyResponseCardEntity.createDate = createDate;
  }
  final String? deleted = jsonConvert.convert<String>(json['deleted']);
  if (deleted != null) {
    emergencyResponseCardEntity.deleted = deleted;
  }
  final String? frontView = jsonConvert.convert<String>(json['frontView']);
  if (frontView != null) {
    emergencyResponseCardEntity.frontView = frontView;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    emergencyResponseCardEntity.id = id;
  }
  final String? nameOfEmergencyResponseCard = jsonConvert.convert<String>(json['nameOfEmergencyResponseCard']);
  if (nameOfEmergencyResponseCard != null) {
    emergencyResponseCardEntity.nameOfEmergencyResponseCard = nameOfEmergencyResponseCard;
  }
  final String? updateBy = jsonConvert.convert<String>(json['updateBy']);
  if (updateBy != null) {
    emergencyResponseCardEntity.updateBy = updateBy;
  }
  final String? updateById = jsonConvert.convert<String>(json['updateById']);
  if (updateById != null) {
    emergencyResponseCardEntity.updateById = updateById;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    emergencyResponseCardEntity.updateDate = updateDate;
  }
  return emergencyResponseCardEntity;
}

Map<String, dynamic> $EmergencyResponseCardEntityToJson(EmergencyResponseCardEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['applicableAccidentTypes'] = entity.applicableAccidentTypes;
  data['backView'] = entity.backView;
  data['cardholder'] = entity.cardholder;
  data['companyCode'] = entity.companyCode;
  data['createBy'] = entity.createBy;
  data['createById'] = entity.createById;
  data['createDate'] = entity.createDate;
  data['deleted'] = entity.deleted;
  data['frontView'] = entity.frontView;
  data['id'] = entity.id;
  data['nameOfEmergencyResponseCard'] = entity.nameOfEmergencyResponseCard;
  data['updateBy'] = entity.updateBy;
  data['updateById'] = entity.updateById;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension EmergencyResponseCardEntityExtension on EmergencyResponseCardEntity {
  EmergencyResponseCardEntity copyWith({
    String? applicableAccidentTypes,
    String? backView,
    String? cardholder,
    String? companyCode,
    String? createBy,
    String? createById,
    String? createDate,
    String? deleted,
    String? frontView,
    String? id,
    String? nameOfEmergencyResponseCard,
    String? updateBy,
    String? updateById,
    String? updateDate,
  }) {
    return EmergencyResponseCardEntity()
      ..applicableAccidentTypes = applicableAccidentTypes ?? this.applicableAccidentTypes
      ..backView = backView ?? this.backView
      ..cardholder = cardholder ?? this.cardholder
      ..companyCode = companyCode ?? this.companyCode
      ..createBy = createBy ?? this.createBy
      ..createById = createById ?? this.createById
      ..createDate = createDate ?? this.createDate
      ..deleted = deleted ?? this.deleted
      ..frontView = frontView ?? this.frontView
      ..id = id ?? this.id
      ..nameOfEmergencyResponseCard = nameOfEmergencyResponseCard ?? this.nameOfEmergencyResponseCard
      ..updateBy = updateBy ?? this.updateBy
      ..updateById = updateById ?? this.updateById
      ..updateDate = updateDate ?? this.updateDate;
  }
}
